<template>
  <div class="tab_home">
    <van-nav-bar
      title="报告"
    />
  </div>
</template>

<script>

import { mapMutations } from 'vuex'
import { NavBar, Toast } from 'vant'

export default {
  data () {
    return {
      isLogin: false,
      reports: []
    }
  },
  components: {
    [NavBar.name]: NavBar
  },
  async mounted () {
    this.getLoginStatus()
    this.setActiveTab(2)
    await this.getReports()
  },
  methods: {
    async getReports () {
      const { data } = await this.$api.report.reportList()
      if (data.code !== 200) {
        Toast(data.desc)
      } else {
        this.reports = data.data
      }
      console.log(data)
    },
    getLoginStatus () {
      this.isLogin =
        !!localStorage.getItem('token') &&
        !!localStorage.getItem('username')
    },
    ...mapMutations({
      setActiveTab: 'tabbar/setActiveTab'
    })
  }
}
</script>

<style>

</style>
